Vue 学习笔记 错误ResizeObserver loop completed with undelivered notifications 您所在的位置:网站首页 Vue resizeobserver loop Vue 学习笔记 错误ResizeObserver loop completed with undelivered notifications

Vue 学习笔记 错误ResizeObserver loop completed with undelivered notifications

2024-07-17 09:32| 来源: 网络整理| 查看: 265

环境Vue3 Ts 使用了el-table 后,容易出现如下错误 ERROR ResizeObserver loop completed with undelivered notifications. at handleError (webpack-internal:///./node_modules/webpack-dev-server/client/overlay.js:299:58) at eval (webpack-internal:///./node_modules/webpack-dev-server/client/overlay.js:318:7) 在这里插入图片描述 解决办法 在App.vue 下面加代码

const debounce = (callback: (...args: any[]) => void, delay: number) => { let tid: any; return function (...args: any[]) { const ctx = self; tid && clearTimeout(tid); tid = setTimeout(() => { callback.apply(ctx, args); }, delay); }; }; const _ = (window as any).ResizeObserver; (window as any).ResizeObserver = class ResizeObserver extends _ { constructor(callback: (...args: any[]) => void) { callback = debounce(callback, 20); super(callback); } }; },

App.vue 完整代码如下:

import { defineComponent } from "vue"; export default defineComponent({ setup() { const debounce = (callback: (...args: any[]) => void, delay: number) => { let tid: any; return function (...args: any[]) { const ctx = self; tid && clearTimeout(tid); tid = setTimeout(() => { callback.apply(ctx, args); }, delay); }; }; const _ = (window as any).ResizeObserver; (window as any).ResizeObserver = class ResizeObserver extends _ { constructor(callback: (...args: any[]) => void) { callback = debounce(callback, 20); super(callback); } }; }, });

为什么??? 我也不清楚原理 ChatGPT 解释如下: 在这里插入图片描述



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有